﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPageAdmin.master" AutoEventWireup="true" CodeFile="User_management.aspx.cs" Inherits="Admin_User_management" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style8
        {
            text-align: right;
            width: 307px;
        }
        .style9
        {
            font-weight: bold;
            color: #3399FF;
        }
        .style10
        {
            font-size: xx-large;
        }
        .style11
        {
            font-size: xx-large;
            font-weight: bold;
            color: #996600;
        }
        .style12
        {
            font-size: xx-large;
            font-weight: bold;
            text-align: center;
            color: #FF3300;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table class="style7">
        <tr>
            <td colspan="2" class="style11" style="text-align: center">
                User Management</td>
        </tr>
        <tr>
            <td colspan="2" class="style10" style="text-align: center">
                &nbsp;</td>
        </tr>
        <tr>
        <script type="text/javascript" language="javascript">
            function changeCheckState() {
                try {
                    var frm = document.forms[0];
                    var i = 0;
                    for (i = 0; i < frm.length; i++) {
                        if (frm.elements[i].id.indexOf('chkCheckItem') != -1) {
                            if (document.getElementById(frm.elements[i].id) != null) {
                                if (frm.elements[i].checked == false) {
                                    frm.elements[i].checked = true;
                                } else {
                                    frm.elements[i].checked = false;
                                }
                            }
                        }
                    }
                } catch (err) { }
            }
</script>
            <td colspan="2" style="text-align: center">

                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CellPadding="4" DataKeyNames="userId" 
                    DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="Vertical" 
                    onselectedindexchanged="GridView1_SelectedIndexChanged">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                         <asp:TemplateField>
        <HeaderTemplate>
        <asp:CheckBox ID="chkHead" runat="server" 
            onclick="changeCheckState(this);" />
        </HeaderTemplate>
        <ItemTemplate>
            <asp:CheckBox ID="chkCheckItem" runat="server" />
        </ItemTemplate>
    </asp:TemplateField>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="userName" HeaderText="User name" 
                            SortExpression="userName" />
                        <asp:BoundField DataField="password" HeaderText="Password" 
                            SortExpression="password" Visible="False" />
                        <asp:BoundField DataField="fullName" HeaderText="Full name" 
                            SortExpression="fullName" />
                        <asp:BoundField DataField="email" HeaderText="Email" SortExpression="email" />
                        <asp:BoundField DataField="roleId" HeaderText="Role Id" 
                            SortExpression="roleId" />
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                    SelectCommand="SELECT * FROM [tblUser]"></asp:SqlDataSource>
            </td>
        </tr>

        
        <tr>
            <td colspan="2" style="text-align: center">

                <asp:Button ID="Button1" runat="server" Text="Add" onclick="Button1_Click1" />
&nbsp;
                <asp:Button ID="Button5" runat="server" onclick="Button5_Click" Text="Edit" />
&nbsp;
                <asp:Button ID="Button3" runat="server" Text="Delete" onclick="Button3_Click" />
            </td>
        </tr>

        
            <tr>

        
            <td class="style12" colspan="2">
                <asp:Label ID="Label6" runat="server" style="color: #CC9900" Text="EDIT USER" 
                    Visible="False"></asp:Label>
                </td>
        </tr>
        
        
            <td class="style8">
                <asp:Label ID="Label1" runat="server" CssClass="style9" Text="User name" 
                    Visible="False"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtUsername" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                <asp:Label ID="Label2" runat="server" CssClass="style9" Text="Password" 
                    Visible="False"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtPassword" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                <asp:Label ID="Label3" runat="server" CssClass="style9" Text="Full name" 
                    Visible="False"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtFullname" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                <asp:Label ID="Label4" runat="server" CssClass="style9" Text="Email" 
                    Visible="False"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="txtEmail" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style8">
                <asp:Label ID="Label5" runat="server" CssClass="style9" Text="Role ID" 
                    Visible="False"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlRoleid" runat="server" Visible="False">
                    <asp:ListItem Enabled="False" Selected="True">0</asp:ListItem>
                    <asp:ListItem Value="1">Administrator</asp:ListItem>
                    <asp:ListItem Value="2">Staff</asp:ListItem>
                    <asp:ListItem Value="3">Lecturer</asp:ListItem>
                    <asp:ListItem Value="4">Uploader</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="style8">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style8">
                &nbsp;</td>
            <td>
&nbsp;
                <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Edit" 
                    Visible="False" />
&nbsp;
                </td>
        </tr>
    </table>
</asp:Content>

